package com.show.controller;


import com.alibaba.fastjson.JSON;
import com.show.service.SpecialtyService;
import com.show.service.impl.SpecialtyServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * @author 绛河
 */
@WebServlet("/specialty/*")
public class SpecialtyController extends BaseServlet {
    private SpecialtyService specialtyService = new SpecialtyServiceImpl();
    public void searchByNature(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        List<Map<String, Object>> maps = specialtyService.searchTop();
        String jsonString = JSON.toJSONString(maps);
        response.setContentType("text/json;charset=utf-8");
        response.getWriter().write(jsonString);
    }
}
